<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class SPictureInfo extends Model
{
      //
    use SoftDeletes;
    public $table = "s_picture_info";

    protected $fillable = [
        'name', 'pic_type', 'pic_url', 'to_url', 'course_type', 'admin_id', 'created_at'
    ];

    public function adminUser()
    {
        return $this->belongsTo('App\Models\AdminUsers', 'admin_id');
    }

    
    //首页banner
    static public function getBanner($limit=3)
    {
        return self::where('pic_type', 0)->select('name', 'pic_url', 'to_url')->limit($limit)->get();
    }

}
